package com.dearcocoa.config;

import com.dearcocoa.common.Status;
import com.dearcocoa.utils.ResponseUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.web.access.AccessDeniedHandler;

/**
 * <p>
 *  Security 结果处理配置
 * </p>
 *
 * @Package: com.dearcocoa.config
 * @ClassName: SecurityHandlerConfig
 * @Author: shengong
 * @Date: Created in 2020-08-08 21:37
 * @Version: V1.0
 * @Description: TODO
 */
@Configuration
public class SecurityHandlerConfig {
    @Bean
    public AccessDeniedHandler accessDeniedHandler() {
        return (request, response, R) -> ResponseUtil.renderJson(response, Status.ACCESS_DENIED, null);
    }
}
